home *** CD-ROM | disk | FTP | other *** search
- class ElevatorDoor extends MovieClip
- {
- var onEnterFrame;
- var HitSquare;
- var direction;
- var step_out_id;
- var step_in_id;
- var FADE_SPEED = 110;
- var out = false;
- function ElevatorDoor()
- {
- super();
- this.onEnterFrame = this.defaultEnterFrame;
- this.gotoAndStop("closed");
- }
- function defaultEnterFrame()
- {
- if(this.HitSquare.hitTest(_global.Rescuer))
- {
- if(Key.isDown(38))
- {
- if(this._name != "Door3")
- {
- this.direction = 1;
- _global.Rescuer.is_available = false;
- _global.Rescuer.invincible = true;
- _global.Rescuer.Char.gotoAndStop("still");
- this.gotoAndPlay("open");
- this._parent.disable();
- }
- }
- if(Key.isDown(40))
- {
- if(this._name != "Door1")
- {
- this.direction = -1;
- _global.Rescuer.is_available = false;
- _global.Rescuer.invincible = true;
- _global.Rescuer.Char.gotoAndStop("still");
- this.gotoAndPlay("open");
- this._parent.disable();
- }
- }
- }
- }
- function stepOut()
- {
- _global.Rescuer.glevel += this._parent.in_elev.direction;
- _global.Rescuer.resetGround();
- _global.Rescuer.fillMovement();
- this.step_out_id = setInterval(this,"steppingOut",10);
- }
- function steppingOut()
- {
- _global.Rescuer.fadeAlpha(_global.Rescuer._alpha + this.FADE_SPEED);
- if(_global.Rescuer._alpha >= 100)
- {
- clearInterval(this.step_out_id);
- _global.Rescuer.is_available = true;
- _global.Rescuer._alpha = 100;
- if(!_global.Rescuer.currentPowerItem)
- {
- _global.Rescuer.invincible = false;
- }
- this.out = false;
- this._parent.enable();
- this.play();
- }
- }
- function stepIn()
- {
- this._parent.in_elev = this;
- _global.Rescuer.accel = 0;
- this.step_in_id = setInterval(this,"steppingIn",10);
- }
- function steppingIn()
- {
- _global.Rescuer.fadeAlpha(_global.Rescuer._alpha - this.FADE_SPEED);
- if(_global.Rescuer._alpha <= 0)
- {
- clearInterval(this.step_in_id);
- _global.Rescuer._alpha = 0;
- this.play();
- }
- }
- }
-